package co.yixiang.modules.system.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum CardBuyTypeEnum {

	/**
	 * 线上
	 */
	ON_LINE("1", "线上"),

	/**
	 * 线下
	 */
	OFF_LINE("2", "线下"),

	/**
	 * 赠送卡
	 */
	GIVE_AWAY("3","赠送"),

	/**
	 * 附属公司 compan
	 */
	COMPANY("0","附属公司");


	private String value;

	private String desc;

	public static CardBuyTypeEnum toType(String value) {
		return Stream.of(CardBuyTypeEnum.values())
				.filter(p -> p.value.equals(value))
				.findAny()
				.orElse(null);
	}

	public String value() {
		return this.value;
	}

}
